package com.jingtai.shop.webfacade.bo.address;

import cn.hutool.core.util.ObjectUtil;
import com.jingtai.common.webfacade.BaseBO;
import com.jingtai.common.webfacade.error.CommonException;
import com.jingtai.common.webfacade.error.ErrorEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;

/**
 * <p>
 * 修改用户收货地址入参表
 * </p>
 *
 * @author null123
 * @since 2020-11-28
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class UpdateAddressBO extends BaseBO {

    /**
     * 会员ID
     */
    private Long id;
    /**
     * 省
     */
    private String province;
    /**
     * 市
     */
    private String city;
    /**
     * 区
     */
    private String area;
    /**
     * 详细地址
     */
    private String address;
    /**
     * 邮政编码
     */
    private String postalCode;
    /**
     * 收货人
     */
    private String receivingName;
    /**
     * 电话号码
     */
    private String receivingPhone;
    /**
     * 是否默认 0：不默认1：默认
     */
    private Integer isDefault;

    @Override
    public void validate() {
        super.validate();
        if (ObjectUtil.isEmpty(id)) {
            throw new CommonException(ErrorEnum.REQUIRED_PARAM_EMPTY);
        }
    }
}
